/**
 *
 * @Author:   tiannanyihao
 * @Date:     2019-07-09 16:14
 * @Profile:  Alert
 * @Project:  byf

 * @Description:
 *
 */

import { MessageBox } from 'mint-ui'

const Alert = {
  /*确认型alert*/
  alertSure (title, msg, callBack) {
    if (title.length === 0 || !title) title ='提示';
    MessageBox.alert(msg, title).then((action) => {
      if (!callBack) return
      callBack(0) //sure
    })
  },

  /*确认+取消alert*/
  alertChoose (title, msg, cancleTitle, suerTitle, callBack) {
    if (title.length === 0 || !title) title ='提示';
    MessageBox.confirm(msg, title, {
      msg: msg,
      title: title,
      cancelButtonText: cancleTitle,
      confirmButtonText: suerTitle,
    }).then((action) => {
      if (!callBack) return
      callBack(1) //suer
    }).catch((action) => {
      if (!callBack) return
      callBack(0) //cancle
    })
  },

}

export default Alert
